package com.woniu.rabbit.publish_model.consumer;

import lombok.extern.slf4j.Slf4j;
import org.springframework.amqp.rabbit.annotation.RabbitListener;
import org.springframework.context.annotation.Bean;
import org.springframework.stereotype.Component;
import com.woniu.rabbit.topic_model.excange_queue_conf.PublishExchangeAndQueueConfig;

@Component
@Slf4j
public class FanoutCustomerListener {

    /**
     * 1号消费者
     * */
    @RabbitListener(queues = PublishExchangeAndQueueConfig.QUEUE_NAME01) // 绑定 队列
    public void fanoutConsumer01(String msg) {
        System.out.println("1号消费者收到消息，根据订单信息减少库存中。。。。。");
        log.info("1号消费者接收到消息：{}", msg);
    }

    @RabbitListener(queues = PublishExchangeAndQueueConfig.QUEUE_NAME02) // 绑定 队列
    public void fanoutConsumer02(String msg) {
        System.out.println("2号消费者收到消息，根据订单信息发送短信提醒消费者。。。。。");
        log.info("2号消费者接收到消息：{}", msg);
    }

    @RabbitListener(queues = PublishExchangeAndQueueConfig.QUEUE_NAME03) // 绑定 队列
    public void fanoutConsumer03(String msg) {
        System.out.println("3号消费者收到消息，根据订单信息记录日志操作");
        log.info("3号消费者接收到消息：{}", msg);
    }
}
